package com.db.protocol.message;

import com.db.protocol.tags.MsgType;
import com.db.protocol.tags.OrderSide;
import com.db.protocol.tags.Tag;

/**
 * @author nulls.narik
 */
public class ReportMessagePerExchange extends ReportMessage {

    public ReportMessagePerExchange(ReportMessage message) {
        put(Tag.CLIENT_ID, message.getClientID());
        put(Tag.QUANTITY, message.getQuantity());
        put(Tag.EXCHANGE_ID, message.getExchangeID());
    }

    @Override
    public String toString() {
        StringBuilder message = newMsg(MsgType.REPORT);

        message = addPair(message, Tag.CLIENT_ID, get(Tag.CLIENT_ID).toString());
        message = addPair(message, Tag.QUANTITY, get(Tag.QUANTITY).toString());
        message = addPair(message, Tag.EXCHANGE_ID, get(Tag.EXCHANGE_ID).toString());

        return message.toString();
    }

    public String getClientID() {
        return (String) get(Tag.CLIENT_ID);
    }

    public Integer getQuantity() {
        return (Integer) get(Tag.QUANTITY);
    }

    public void addQuantity(Integer quantity) {
        put(Tag.QUANTITY, getQuantity() + quantity);
    }

    public String getExchangeID() {
        return (String) get(Tag.EXCHANGE_ID);
    }

    public String getStockName() {
        throw new UnsupportedOperationException();
    }

    public OrderSide getOrderSide() {
        throw new UnsupportedOperationException();
    }

    public Float getPrice() {
        throw new UnsupportedOperationException();
    }
}
